package services;

import Dao.OrdersDao;
import entity.OrdersBean;

import java.sql.SQLException;
import java.sql.Timestamp;
import java.util.List;

public class OrdersService {
    private OrdersDao ordersDao= new OrdersDao();
    //获取所有订单信息
    public List<OrdersBean> getOrdersAll(){
        return ordersDao.getOrdersAll();
    }
    //通过id获取指定订单信息
    public OrdersBean getOrderID(int order_id){
        return ordersDao.getOrderID(order_id);
    }
    //添加一个订单
    public int addOrders(OrdersBean ordersBean) throws SQLException {
        return ordersDao.addOrders(ordersBean);
    }
    //修改订单的可用时间和球桌号
    public int updateOrders(int court_id, Timestamp available_time,int order_id){
        return ordersDao.updateOrders(court_id,available_time,order_id);
    }
    //修改支付状态
    public int updatePayment(String payment_state,int order_id){
        return ordersDao.updatePayment(payment_state,order_id);
    }
    //根据台球类型，支付状态，台球号
    public List<OrdersBean> searchOrders(String courts_type_name,String payment_state,String courts_table){
        return ordersDao.searchOrders(courts_type_name, payment_state, courts_table);
    }

    public int doSettle(int uuid, Timestamp now, int total_amount){
        return ordersDao.doSettle(uuid, now,total_amount);
    }

    public OrdersBean getOrderByCourt_id(int court_id){
        return ordersDao.getOrderByCourt_id(court_id);
    }
}
